package cn.dnui_xcz826.dnuifood_16110100826.controller;

import android.content.Context;
import android.content.SharedPreferences;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import cn.dnui_xcz826.dnuifood_16110100826.R;


public abstract class BaseActivity extends AppCompatActivity {
    protected int layout_file= R.layout.activity_main;
    abstract void initViews();
    abstract void initEvents();
    abstract void initDatas();
    void setLayout(int layout_file){
        setContentView(layout_file);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setLayout(layout_file);
        initViews();
        initEvents();
        initDatas();
    }
    public String getUser_id(){
        SharedPreferences sp;
        sp=getSharedPreferences("userInfo", Context.MODE_PRIVATE);
        return sp.getString("user_id","");
    }
    public String getUser_password()
    {
        SharedPreferences sp;
        sp =getSharedPreferences("userinfo", Context.MODE_PRIVATE);
        return sp.getString("userpass", "");
    }
    public SharedPreferences getSPFile()
    {
        SharedPreferences sp;
        sp =getSharedPreferences("photo", Context.MODE_PRIVATE);
        return sp;
    }
}
